#include <stdexcept>
#include <iostream>
using namespace std;


class C
{
public:
	const int m_1;
	int m_2;
	void func1()
	{};
	void func2() const {};
};


class A
{
public:
	void func1() const;
	static void func2();
	void func3() throw(std::invalid_argument);
	static int m_a;
	const static int m_b;
	const int m_c;
	int m_d;
	A();
};

void A::func1() const//like throw, const must be writen
{
	int tmp = m_d;
//	m_d = 2;//can not do this
}

void A::func2()//static can not be writen
{
}

void A::func3() throw(std::invalid_argument)
{

}

A::A():m_c(1)//const 必须在初始化的时候赋值
{
}


int A::m_a;//static 只需声明的时候带
const int A::m_b = 2;//const 必须带

int main()
{
	A a;
	cout << a.m_a << endl;
	cout << a.m_b << endl;
	a.func1();

	const C *p_c = new C();
//	p_c->func1();//can only call const functions
	p_c->func2();
	cout << p_c->m_1 << " " << p_c->m_2 << endl;//this is ok
	return 0;
}
